﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AspNetCs.Common;
using AspNetCs.Bll;
using AspNetCs.Model;
using System.Text;
using AspNetCs.Enumerations.Channel_Enum;

public partial class Skins_HappyPet_Default : BasePage
{
    protected int id = 0;
    protected HappyPetModel mdel = new HappyPetModel();

    protected void Page_Load(object sender, EventArgs e)
    {


        Response.Buffer = true;
        Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
        Response.Expires = 0;
        Response.CacheControl = "no-cache";
        Response.AddHeader("Pragma", "No-Cache");


        if (Request["id"] != null)
        {
            id = StringHelper.isNumber_int(Request["id"].ToString());
        }
        mdel = HapppNet_BLL.CreatNew.GetModel(id);
        if (mdel.Id <= 0)
        {
            ShowMsgBack("错误提示：当前不存在!");
            Response.End();
        }

        StringBuilder newstr = new StringBuilder();
        newstr.AppendLine("<script src='" + configInfo.InstallDir + "Script/jquery.js'></script>");
        newstr.AppendLine("<script src='" + configInfo.InstallDir + "Script/public.js'></script>");
        string MusicStr = Music_Bll.CreateNew.MusicPath(mdel.MusicId);
        if (MusicStr != "")
        {
            newstr.AppendLine("<script>$(function(){ $(\"<bgsound src='" + MusicStr + "' loop='-1'>\").appendTo(\"body\");});</script>");
        }

        string ServerUrl = configInfo.InstallDir + StringHelper.ReadConfig("TempleSkin") + Channel_Type.HappyPet.ToString().ToLower() + "/default/index.html";
        strBuilder = TempleBll.CreateNew.WriteHtml(Server.MapPath(ServerUrl), newstr.ToString());
        GetStringData_lable lbReplace = new GetStringData_lable();
        Response.Write(lbReplace.GetResultStr(strBuilder.ToString(), "HappyPet", HapppNet_BLL.CreatNew.GetDataTable(" id=" + id)));

    }
}
